﻿using Modules.CheckIn;
using PmSoft.Quartz;
using Quartz;

namespace ManagementApi.Jobs;


/// <summary>
/// 创建考勤表
/// </summary>
[DisallowConcurrentExecution]//不可并行执行
[JobDescription("0 0 00 1 * ?")]//每月1日00:00:00执行一次
public class CreateCheckinDetailJob : IJob
{
    private readonly CheckInDetailService checkInDetailService;

    public CreateCheckinDetailJob(CheckInDetailService checkInDetailService)
    {
        this.checkInDetailService = checkInDetailService;
    }

    public Task Execute(IJobExecutionContext context)
    {
        checkInDetailService.CreateTable($"checkin_detail_{DateTime.Now.ToString("yyyyMM")}");
        return Task.CompletedTask;
    }
}
